package com.dykj.dati.controller.manage;


import cn.hutool.core.util.IdUtil;
import cn.hutool.crypto.digest.DigestUtil;
import com.dykj.dati.model.user.HUser;
import com.dykj.dati.service.user.IHUserService;
import com.dykj.dati.utils.ReturnUtil;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.*;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;

/**
 * @Author: yc
 * @Date: 2021/9/22 15:48
 */
@Controller
public class ManageLoginController {
    @GetMapping("/")
    public String loginIndex() {
        return "manage/login/index";
    }
    @PostMapping("/userLogin")
    @ResponseBody
    public ModelMap userLogin(HttpServletResponse response, HttpServletRequest request,
                              @RequestParam(value = "username", required = true) String userName,
                              @RequestParam(value = "userpass", required = true) String userPass) {
        ModelMap map = new ModelMap();
        Subject subject = SecurityUtils.getSubject();
        UsernamePasswordToken usernamePasswordToken = new UsernamePasswordToken(userName, DigestUtil.md5Hex(userPass));
        map.put("code",  "未知账户！");
        return map;
    }
}
